//
//  IMSearchChatRecordController.h
//  wanzhaoIM
//
//  Created by wanzhao on 16/1/8.
//  Copyright © 2016年 liuyuantao. All rights reserved.
//

//
//  IMChatRecordController.h
//  wanzhaoIM
//
//  Created by wanzhao on 15/8/12.
//  Copyright (c) 2015年 liuyuantao. All rights reserved.
//



//聊天记录功能
#import <UIKit/UIKit.h>
#import "CContactModel.h"
#import "CHBubbleMessageCell.h"
#import "CGroupModel.h"
@class CMessageModel;

#define INPUT_HEIGHT 44.0f


typedef enum {
    CHRecordViewTimestampPolicyAll = 0,
    CHRecordViewTimestampPolicyAlternating,
    CHRecordViewTimestampPolicyEveryThree,
    CHRecordViewTimestampPolicyEveryFive,
    CHRecordViewTimestampPolicyCustom
} CHRecordViewTimestampPolicy;

@protocol IMSearchChatRecordControllerDelegate <NSObject>
@required
- (CHBubbleMessageType)messageTypeForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CHBubbleStyle)messageStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CHRecordViewTimestampPolicy)timestampPolicy;
- (CHAvatarStyle)avatarStyle;

@optional
- (void)sendImageMessage:(UIImage *)image index:(NSInteger)index;
- (void)sendTextMessage:(NSString *)message;
- (BOOL)ismapForRowAtIndexPath:(NSIndexPath *)indexPath;
@optional
- (BOOL)hasTimestampForRowAtIndexPath:(NSIndexPath *)indexPath;
@end

@protocol IMSearchChatRecordControllerDataSource <NSObject>
@required
- (int64_t)voiceMessageDBIDForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)voiceIsPlayForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)voiceTimeForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)voiceURIForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSArray *)pictureURIArrayForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)senderNameForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)senderTitleForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)textForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSDate *)timestampForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)avatarImageURIForReceivedMessageRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)avatarImageURIForSendedMessageRowAtIndexPath:(NSIndexPath *)indexPath;
- (int32_t)messageStatusForRowAtIndexPath:(NSIndexPath *)indexPath;
- (uint32_t)memoryIDForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)isNoticeForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)fileNameForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)fileIdForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)chatTypeForRowAtIndexPath:(NSIndexPath *)indexPath;

@end

@interface IMSearchChatRecordController : UIViewController <UITableViewDataSource, UITableViewDelegate, UITextViewDelegate,CHBubbleMessageCellDelegate,UIActionSheetDelegate>
{
    __weak id<IMSearchChatRecordControllerDelegate> _delegate;
    __weak id<IMSearchChatRecordControllerDataSource> _dataSource;
}
@property (weak, nonatomic) id<IMSearchChatRecordControllerDelegate> delegate;
@property (weak, nonatomic) id<IMSearchChatRecordControllerDataSource> dataSource;
@property (strong, nonatomic) UITableView *tableView;
@property (strong, nonatomic) NSMutableArray *messages;
@property (nonatomic, strong) CContactModel *member;
@property (nonatomic, strong) CGroupModel *group;
@property (nonatomic, strong) CMessageModel *message;
//@property (nonatomic ,retain) ChatToolMoreView* moreView;

@property (assign, nonatomic) CGFloat previousTextViewContentHeight;

#pragma mark - Messages view controller
- (BOOL)shouldHaveTimestampForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)setBackgroundColor:(UIColor *)color;
//- (void)jumpToDetailInfoView:(id)sender;

@end
